﻿
@{
    ViewBag.Title = "登录 - " + ViewBag.DomainTitle + "数据中心";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<style>
    html {
        width: 100%;
        height: 100%;
    }

    body {
        background-image: url(/Resources/img/bg.jpg);
        background-repeat: no-repeat,no-repeat;
        background-position: center center,center center;
        background-size: cover,cover;
    }
</style>

<form id="dataForm">
    <div class="tc-panel-back"></div>
    <div class="tc-panel tc-login">
        <div class="tc-login-logo">
            <h2>@ViewBag.DomainTitle 数据中心</h2>
        </div>
        <div class="tc-login-option">
            <h1>登录</h1>
        </div>
        <div class="tc-login-option">
            <input type="text" placeholder="用户名" class="layui-input" name="account" value="">
        </div>
        <div class="tc-login-option">
            <input type="password" placeholder="密码" class="layui-input" name="password" value="">
        </div>
        <div class="tc-login-option">
            <input type="text" placeholder="图形验证码" class="layui-input tc-login-option-small" name="code">
            <img src="~/Resources/img/img_error.jpg" class="tc-login-img" id="login-code" onclick="javascript: { login.getLoginCode(); }" />
        </div>
        <div class="tc-login-option">
            <a class="layui-btn tc-login-w100" onclick="javascript: { login.submit(); }">登录</a>
        </div>
    </div>
</form>

@Html.Partial("~/Views/Shared/_Script.cshtml")

<script>
    var login = new Login();
    login.getLoginCode();

    function Login() {
        this.getLoginCode = function () {
            $.post('/Login/AjaxLoginCode', {}, function (result) {
                $('#login-code').attr('src', result.data);
            });
        };
        this.submit = function () {
            var data = $('#dataForm').getForm();
            $.post('/Login/AjaxLoginSubmit', data, function (result) {
                location.reload();
            });
        };
    };
</script>